home *** CD-ROM | disk | FTP | other *** search
/ Mastering Microsoft Visual Basic 5 / Mastering Microsoft Visual Basic 5.ISO / sampapps / event notification / form1.frm next >
Text File  |  1997-01-15  |  4KB  |  140 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   3015
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4680
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3015
  10.    ScaleWidth      =   4680
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.TextBox txtInterval 
  13.       Height          =   375
  14.       Left            =   2400
  15.       TabIndex        =   3
  16.       Text            =   "500"
  17.       Top             =   1260
  18.       Width           =   855
  19.    End
  20.    Begin VB.CommandButton cmdStop 
  21.       Caption         =   "Sto&p"
  22.       Height          =   435
  23.       Index           =   1
  24.       Left            =   2520
  25.       TabIndex        =   1
  26.       Top             =   540
  27.       Width           =   1335
  28.    End
  29.    Begin VB.CommandButton cmdStart 
  30.       Caption         =   "&Start"
  31.       Height          =   435
  32.       Index           =   0
  33.       Left            =   540
  34.       TabIndex        =   0
  35.       Top             =   540
  36.       Width           =   1335
  37.    End
  38.    Begin VB.Image Image1 
  39.       Height          =   480
  40.       Index           =   5
  41.       Left            =   1980
  42.       Picture         =   "Form1.frx":0000
  43.       Top             =   2100
  44.       Visible         =   0   'False
  45.       Width           =   480
  46.    End
  47.    Begin VB.Image Image1 
  48.       Height          =   480
  49.       Index           =   4
  50.       Left            =   1980
  51.       Picture         =   "Form1.frx":030A
  52.       Top             =   2100
  53.       Visible         =   0   'False
  54.       Width           =   480
  55.    End
  56.    Begin VB.Image Image1 
  57.       Height          =   480
  58.       Index           =   3
  59.       Left            =   1980
  60.       Picture         =   "Form1.frx":074C
  61.       Top             =   2100
  62.       Visible         =   0   'False
  63.       Width           =   480
  64.    End
  65.    Begin VB.Image Image1 
  66.       Height          =   480
  67.       Index           =   2
  68.       Left            =   1980
  69.       Picture         =   "Form1.frx":0B8E
  70.       Top             =   2100
  71.       Visible         =   0   'False
  72.       Width           =   480
  73.    End
  74.    Begin VB.Image Image1 
  75.       Height          =   480
  76.       Index           =   1
  77.       Left            =   1980
  78.       Picture         =   "Form1.frx":0FD0
  79.       Top             =   2100
  80.       Visible         =   0   'False
  81.       Width           =   480
  82.    End
  83.    Begin VB.Image Image1 
  84.       Height          =   480
  85.       Index           =   0
  86.       Left            =   1980
  87.       Picture         =   "Form1.frx":1412
  88.       Top             =   2100
  89.       Width           =   480
  90.    End
  91.    Begin VB.Label Label1 
  92.       Caption         =   "&Interval(milliseconds):"
  93.       Height          =   255
  94.       Left            =   720
  95.       TabIndex        =   2
  96.       Top             =   1320
  97.       Width           =   1455
  98.    End
  99. End
  100. Attribute VB_Name = "Form1"
  101. Attribute VB_GlobalNameSpace = False
  102. Attribute VB_Creatable = False
  103. Attribute VB_PredeclaredId = True
  104. Attribute VB_Exposed = False
  105. Option Explicit
  106. Private WithEvents objNotify As Notifier
  107. Dim idxCurrent As Long
  108.  
  109. Private Sub cmdStart_Click(Index As Integer)
  110.   ' If the Notify object is not enabled, set the interval
  111.   ' and enable it.
  112.   If Not objNotify.Enabled Then
  113.     objNotify.Interval = txtInterval
  114.     objNotify.Enabled = True
  115.   End If
  116. End Sub
  117.  
  118. Private Sub cmdStop_Click(Index As Integer)
  119.   If objNotify.Enabled Then
  120.     objNotify.Enabled = False
  121.   End If
  122. End Sub
  123.  
  124. Private Sub Form_Load()
  125.   ' Create the Nofitier object
  126.   Set objNotify = New Notifier
  127.   idxCurrent = 0
  128. End Sub
  129.  
  130. Private Sub objNotify_Alarm()
  131. ' As the alarm sounds, simply increment the index of the
  132. ' icon which is to be displayed.
  133.   Dim idxNext As Long
  134.   idxNext = idxCurrent + 1
  135.   If idxNext > 5 Then idxNext = 0
  136.   Image1(idxNext).Visible = True
  137.   Image1(idxCurrent).Visible = False
  138.   idxCurrent = idxNext
  139. End Sub
  140.